package com.jameci.luntan.controller;

import com.jameci.luntan.dto.PostDTO;
import com.jameci.luntan.mapper.PostMapper;
import com.jameci.luntan.model.Post;
import com.jameci.luntan.model.User;
import com.jameci.luntan.service.PostService;
import jakarta.servlet.http.HttpServletRequest;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class PostController {
    @Autowired
    private PostService postService;
    @GetMapping("/post")
    public String post(
            Model model,
            @RequestParam(name = "id") int id
    ) {
        PostDTO postDTO = postService.getPostById(id);
        model.addAttribute("postDTO", postDTO);
        return "post";
    }
}
